package br.com.async.application.impl;

import java.util.List;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import br.com.async.application.CategoryApplication;
import br.com.async.domain.room.Category;
import br.com.async.domain.room.CategoryRepository;
@Transactional (propagation=Propagation.REQUIRED)
public class CategoryApplicationImpl implements CategoryApplication {

	private CategoryRepository categoryRepository;

	public CategoryApplicationImpl(CategoryRepository categoryRepository) {
		super();
		this.categoryRepository = categoryRepository;
	}

	@Override
	public void persist(Category entity) {
		categoryRepository.persist(entity);
	}

	@Override
	public void update(Category entity) {
		categoryRepository.update(entity);
	}

	@Override
	public List<Category> list() {
		return categoryRepository.list();
	}

	@Override
	public void disable(Category entity) {
		categoryRepository.disable(entity);
	}

	@Override
	public Category findByCode(Integer code) {
		return categoryRepository.findByCode(code);
	}

}
